package com.enen.service.impl;

import com.enen.mapper.LogMapper;
import com.enen.pojo.LogQueryParam;
import com.enen.pojo.OperateLog;
import com.enen.pojo.PageResult;
import com.enen.pojo.Student;
import com.enen.service.LogService;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class LogServiceImpl implements LogService {
    @Autowired
    private LogMapper logMapper;
    @Override
    public PageResult<OperateLog> findAll(LogQueryParam logQueryParam) {
        //1.设置分页参数(PageHelper)
        PageHelper.startPage(logQueryParam.getPage(),logQueryParam.getPageSize());
        //2.执行查询
        List<OperateLog> clazzList = logMapper.findAll(logQueryParam);
        //3.解析查询结果，并封装
        Page<OperateLog> p =(Page<OperateLog>)clazzList;
        return new PageResult<OperateLog>(p.getTotal(),p.getResult());
    }
}
